<!DOCTYPE html>
<html lang="en">

	<head>
		<meta charset="UTF-8">
		<title>个人信息</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="format-detection" content="telephone=no">

		<link rel="stylesheet" type="text/css" href="/static/manage/common/bootstrap/js/bootstarp-3.3.7/css/bootstrap.min.css" />
		<script src="/static/manage/common/bootstrap/js/jquery-3.2.0.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="/static/manage/common/bootstrap/js/bootstarp-3.3.7/js/bootstrap.min.js" type="text/javascript" charset="utf-8"></script>
		<link rel="stylesheet" type="text/css" href="/static/manage/common/bootstrap/js/bootstarp-table-1.11.1/bootstrap-table.min.css" />
		<script src="/static/manage/common/bootstrap/js/bootstarp-table-1.11.1/bootstrap-table.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="/static/manage/common/bootstrap/js/bootstarp-table-1.11.1/bootstrap-table-zh-CN.min.js" type="text/javascript" charset="utf-8"></script>

		<!--
        	富文本编辑器导入包
        -->
		<link href="/static/manage/common/bootstrap/js/dist/summernote.css" rel="stylesheet">
		<script src="/static/manage/common/bootstrap/js/dist/summernote.js"></script>
		<script src="/static/manage/common/bootstrap/js/dist/lang/summernote-zh-CN.js"></script>
		<!-- 中文-->
		
		<style>
			.m {
				width: 800px;
				margin-left: auto;
				margin-right: auto;
			}
		</style>
	</head>

	<body>
		<form class="form-inline">
			<div class="form-group">
				<label for="exampleInputName2">项目编号：</label>
				<input type="text" class="form-control" id="project_id" name="project_id" placeholder="请输入编号">
			</div>
			<div class="form-group">
				<label for="exampleInputEmail2">项目名称：</label>
				<input type="text" class="form-control" id="project_name" name="project_name" placeholder="请输入名称">
			</div>
			<div class="form-group">
				<label for="exampleInputEmail2">分类：</label>
				<select class="form-control" id="type_id" name="type_id">
					<option></option>
				</select>
			</div>
			<div class="form-group">
				<label for="exampleInputEmail2">状态：</label>
				<select class="form-control" id="status" name="status">
					<option value="0"></option>
					<option value="1">在售</option>
					<option value="2">下架</option>
				</select>
			</div>
			<button type="button" class="btn btn-primary" id="btns"><span class="glyphicon glyphicon-search" aria-hidden="true"></span>&nbsp;查询</button>
			<button type="reset" class="btn btn-info" id="resetBtn"><span class="glyphicon glyphicon-repeat" aria-hidden="true"></span>&nbsp;重置</button>
			<!-- Button trigger modal -->
			<button type="button" class="btn btn-success" data-toggle="modal" data-target="#myModal"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span>&nbsp;新增</button>
		</form>

		<div>
			<table id="table">

			</table>

			<!-- 添加Modal -->
			<form class="form-inline" id="fm" name="myform" action="/bnp/addProjects" method="post" enctype="multipart/form-data">
				<div class="modal fade" id="myModal" tabindex="-1" style="overflow: auto" role="dialog" aria-labelledby="myModalLabel">
					<div class="modal-dialog" role="document" style="width: 1000px;">
						<div class="modal-content">
							
							<div class="modal-header">
								<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
								<h4 class="modal-title" id="myModalLabel">护理项目添加列表</h4>
							</div>
							
							<table class="table table-bordered">
							<tr>
								<td>
									<label for="exampleInputName2">项目名称：</label>
								</td>
								<td>
									<input type="text" class="form-control" id="project_name" name="project_name" placeholder="请输入内容">
								</td>
								<td>
									<label for="exampleInputEmail2">分类：</label>
								</td>
								<td>
									<select class="form-control" id="type_id1" name="type_id">
										<option></option>
									</select>
								</td>
							</tr>
							<tr>
								<td>
									<label for="exampleInputName2">列表图片：</label>
								</td>
								<td>
									<input type="file" class="form-control" id="cover_photo" name="file">
								</td>
								<td>
									<label for="exampleInputName2">封面图片：</label>
								</td>
								<td>
									<input type="file" class="form-control" id="cover_big_photo" name="file">
								</td>
							</tr>
							<tr>
								<td>
									<label for="exampleInputName2">服务时长：</label>
								</td>
								<td>
									<input type="number" class="form-control" id="server_time" name="server_time" placeholder="请输入内容">&nbsp;分钟
								</td>
								<td>
									<label for="exampleInputName2">人民币售价：</label>
								</td>
								<td>
									<input type="number" class="form-control" id="rmb_price" name="rmb_price" placeholder="请输入内容">&nbsp;元
								</td>
							</tr>
							<tr>
								<td>
									<label for="exampleInputName2">颜值售价：</label>
								</td>
								<td>
									<input type="number" class="form-control" id="beauty_price" name="beauty_price" placeholder="请输入内容">&nbsp;个
								</td>
								<td>
									<label for="exampleInputName2">标准手工费：</label>
								</td>
								<td>
									<input type="number" class="form-control" id="manual_price" name="manual_price" placeholder="请输入内容">&nbsp元;
								</td>
							</tr>
							<tr>
								<td>
									<label for="exampleInputName2">活动手工费：</label>
								</td>
								<td>
									<input type="number" class="form-control" id="active_price" name="active_price" placeholder="请输入内容">&nbsp;元
								</td>
								<td>
									<label for="exampleInputEmail2">状态：</label>
								</td>
								<td>
									<select class="form-control" id="status" name="status">
										<option value="1">在售</option>
										<option value="2">下架</option>
									</select>
								</td>
							</tr>
							<tr>
								<td>
									<label for="exampleInputName2">排序号：</label>
								</td>
								<td>
									<input type="number" class="form-control" id="sort_no" name="sort_no" value="1">
								</td>
								<td>
									<label for="exampleInputName2">所用设备：</label>
								</td>
								<td>
									<input type="text" class="form-control" id="use_device" name="use_device" placeholder="请输入内容">
								</td>
							</tr>
							</table>
							
							<div class="form-group">
								<label for="inputEmail3" class="col-sm-2 control-label" name="test">内容描述：</label>
								<div class="col-sm-4">
									<div class="m">
										<div class="summernote" id="content_editer"></div>
										<input type="hidden" id="content" name="content" value="">
									</div>
								</div>
							</div>
							
							<div class="modal-footer">
								<button type="button" class="btn btn-default" data-dismiss="modal" onclick="restClose()">关闭</button>
								<button type="button" class="btn btn-primary" id="addbtn">保存</button>
							</div>
							
						</div>
					</div>
				</div>
			</form>

			<!-- 修改Modal -->
			<form class="form-inline" id="fm2" name="myform2" action="/bnp/updateProject" method="post" enctype="multipart/form-data">
				<div class="modal fade" id="myModal2" tabindex="-1" style="overflow: auto" role="dialog" aria-labelledby="myModalLabel">
					<div class="modal-dialog" role="document" style="width: 1000px;">
						<div class="modal-content">
							
							<div class="modal-header">
								<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
								<h4 class="modal-title" id="myModalLabel">护理项目修改列表</h4>
							</div>
							
							<table class="table table-bordered">
								<tr>
									<td>
										<input type="hidden" class="form-control" id="project_id1" name="project_id" value="">
										<label for="exampleInputName2">项目名称：</label>
									</td>
									<td>	
										<input type="text" class="form-control" id="project_name1" name="project_name">
									</td>
									<td>
										<label for="exampleInputEmail2">分类：</label>
									</td>
									<td>	
										<select class="form-control" id="type_id2" name="type_id">
										</select>
									</td>
								</tr>
								<tr>
									<td>
										<label for="exampleInputName2">服务时长：</label>
									</td>
									<td>	
										<input type="number" class="form-control" id="server_time1" name="server_time">&nbsp;分钟
									</td>
									<td>
										<label for="exampleInputName2">人民币售价：</label>
									</td>
									<td>	
										<input type="number" class="form-control" id="rmb_price1" name="rmb_price">&nbsp;元
									</td>
								</tr>
								<tr>
									<td>
										<label for="exampleInputName2">颜值售价：</label>
									</td>
									<td>	
										<input type="number" class="form-control" id="beauty_price1" name="beauty_price">&nbsp个;
									</td>
									<td>
										<label for="exampleInputName2">标准手工费：</label>
									</td>
									<td>	
										<input type="number" class="form-control" id="manual_price1" name="manual_price">&nbsp;元
									</td>
								</tr>
								<tr>
									<td>
										<label for="exampleInputName2">活动手工费：</label>
									</td>
									<td>	
										<input type="number" class="form-control" id="active_price1" name="active_price">&nbsp;元
									</td>
									<td>
										<label for="exampleInputEmail2">状态：</label>
									</td>
									<td>	
										<select class="form-control" id="status1" name="status">
											<option value="1">在售</option>
											<option value="2">下架</option>
										</select>
									</td>
								</tr>
								<tr>
									<td>
										<label for="exampleInputName2">排序号：</label>
									</td>
									<td>	
										<input type="number" class="form-control" id="sort_no1" name="sort_no">
									</td>
									<td>
										<label for="exampleInputName2">使用设备：</label>
									</td>
									<td>	
										<input type="text" class="form-control" id="use_device1" name="use_device">
									</td>
									
								</tr>
								<tr>
									<td>
										<label for="exampleInputName2">列表图片：</label>
									</td>
									<td>
										<span class="h-cont h-right"><img src="" id="cover_photo3" width="100" height="100"/></span>
										<input type="file" class="form-control" id="cover_photo1" name="file">
									</td>
									<td>
										<label for="exampleInputName2">封面图片：</label>
									</td>
									<td>
										<span class="h-cont h-left"><img src="" id="cover_big_photo3" width="100" height="100" /></span>
										<input type="file" class="form-control" id="cover_big_photo1" name="file">
									</td>
								</tr>
								</table>
								<div class="form-group">
								<label for="inputEmail3" class="col-sm-2 control-label" name="test">内容描述：</label>
								<div class="col-sm-4">
									<div class="m">
										<div class="summernote" id="content_editer1"></div>
										<input type="hidden" id="content1" name="content" value="">
									</div>
								</div>
							</div>
								
								<div class="modal-footer">
									<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
									<button type="button" class="btn btn-primary" id="updatebtn">保存</button>
								</div>
								
							</div>
						</div>
					</div>
			</form>
			
			<!-- 查看详情Modal -->
			<form class="form-inline" id="fm3">
				<div class="modal fade" id="myModal3" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
					<div class="modal-dialog" role="document" style="width: 1000px;">
						<div class="modal-content">
							
							<div class="modal-header">
								<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
								<h4 class="modal-title" id="myModalLabel" align="center">护理项目详细信息</h4>
							</div>
							
							<table class="table table-bordered">
								<tr>
									<td>
										<span class="h-cont h-right">服务编号：</span>
									</td>
									<td>	
										<span class="h-cont h-right" id="project_id2"></span>
									</td>
									<td>
										<span class="h-cont h-right">护理项目名称：</span>
									</td>
									<td>	
										<span class="h-cont h-right" id="project_name2"></span>
									</td>
									
								</tr>
								<tr>
									<td>
										<span class="h-cont h-right">列表图片：</span>
									</td>
									<td>	
										<span class="h-cont h-right"><img src="" id="cover_photo2" width="100" height="100"/></span>
									</td>
									<td>
										<span class="h-cont h-right">封面图片：</span>
									</td>
									<td>	
										<span class="h-cont h-left"><img src="" id="cover_big_photo2" width="100" height="100" /></span>
									</td>
								</tr>
								<tr>
									<td>
										<span class="h-cont h-right">服务类型：</span>
									</td>
									<td>	
										<span class="h-cont h-right" id="type_id3"></span>
									</td>
									<td>
										<span class="h-cont h-right">服务时长：</span>
									</td>
									<td>	
										<span class="h-cont h-right" id="server_time2"></span>&nbsp;分钟
									</td>
									
								</tr>
								<tr>
									<td>
										<span class="h-cont h-right">人民币售价：</span>
									</td>
									<td>	
										<span class="h-cont h-left" id="rmb_price2"></span>&nbsp;元
									</td>
									<td>
										<span class="h-cont h-right">颜值售价：</span>
									</td>
									<td>	
										<span class="h-cont h-left" id="beauty_price2"></span>&nbsp;个
									</td>
									
								</tr>
								<tr>
									<td>
										<span class="h-cont h-right">标准手工费：</span>
									</td>
									<td>	
										<span class="h-cont h-left" id="manual_price2"></span>&nbsp;元
									</td>
									<td>
										<span class="h-cont h-right">活动手工费：</span>
									</td>
									<td>	
										<span class="h-cont h-left" id="active_price2"></span>&nbsp;元
									</td>
									
								</tr>
								<tr>
									<td>
										<span class="h-cont h-right">状态 ：</span>
									</td>
									<td>	
										<span class="h-cont h-left" id="status2"></span>
									</td>
									<td>
										<span class="h-cont h-right">排序号：</span>
									</td>
									<td>	
										<span class="h-cont h-left" id="sort_no2"></span>
									</td>
									
								</tr>
								<tr>
									<td>
										<span class="h-cont h-right">创建时间：</span>
									</td>
									<td>	
										<span class="h-cont h-left" id="create_time2"></span>
									</td>
									<td>
										<span class="h-cont h-right">修改时间：</span>
									</td>
									<td>	
										<span class="h-cont h-left" id="modify_time2"></span>
									</td>
								</tr>
								<tr>
									<td>
										<span class="h-cont h-right">使用设备：</span>
									</td>
									<td>	
										<span class="h-cont h-left" id="use_device2"></span>
									</td>
									
								</tr>
								
								</table>
								
							<div class="form-group">
								<label for="inputEmail3" class="col-sm-2 control-label" name="test">内容描述：</label>
								<div class="col-sm-4">
									<div class="m">
										<div class="summernote" id="content_editer2"></div>
										<input type="hidden" id="content2" name="content" value="">
									</div>
								</div>
							</div>
								
								<div class="modal-footer">
									<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
								</div>
								
							</div>
						</div>
					</div>
			</form>
			</div>
	</body>
	<script type="text/javascript">
		$(function() {

			//1.初始化Table

			var oTable = new TableInit();

			oTable.Init();
		});

		var TableInit = function() {
			var oTableInit = new Object();
			//初始化Table
			oTableInit.Init = function() {

				$('#table').bootstrapTable({

					method: 'get',

					contentType: "application/x-www-form-urlencoded",

					url: "/bnp/list", //请求后台的URL（*）

					striped: true, //是否显示行间隔色

					locale: 'zh-CN', //中文支持

					pagination: true, //是否开启分页（*）

					pageNumber: 1, //初始化加载第一页，默认第一页

					pageSize: 5, //每页的记录行数（*）

					pageList: [3, 5, 7], //可供选择的每页的行数（*）

					cache: false, //是否使用缓存，默认为true，所以一般情况下需要设置一下这个属性（*）

					sortable: false, //是否启用排序

					sortOrder: "asc", //排序方式

					sidePagination: "server", //分页方式：client客户端分页，server服务端分页（*）

					showRefresh: true, //刷新按钮

					queryParams: oTableInit.queryParams, //传递参数（*）

					showColumns: true, //是否显示所有的列

					showRefresh: true, //是否显示刷新按钮

					clickToSelect: true, //是否启用点击选中行
					
					uniqueId: "project_id", //每一行的唯一标识，一般为主键列

					columns: [{
						field: 'project_id',
						title: '项目编号',
						align: 'center',
					},{
						field: 'cover_photo',
						title: '列表图片',
						align: 'center',
						formatter: function(value, row, index) {
							return "<img src='"+value+"' width='80px' height='60px'>"
						}
					}, {
						field: 'project_name',
						title: '项目名称',
						align: 'center',
					}, {
						field: 'bisNurseType.type_name',
						title: '分类',
						align: 'center',
					}, {
						field: 'server_time',
						title: '服务时长',
						align: 'center',
					}, {
						field: 'rmb_price',
						title: '人民币售价',
						align: 'center',
					}, {
						field: 'beauty_price',
						title: '颜值售价',
						align: 'center',
					}, {
						field: 'manual_price',
						title: '标准手工费',
						align: 'center',
					}, {
						field: 'active_price',
						title: '活动手工费',
						align: 'center',
					}, {
						field: 'status',
						title: '状态',
						align: 'center',
						formatter: function(value, row, index) {
							switch(Number(value)) {
								case 1:
									return "在售";
									break;
								case 2:
									return "下架";
									break;
							}
						}
					}, {
						field: 'modify_time',
						title: '更新时间',
						align: 'center',
						//获取日期列的值进行转换
						formatter: function(value, row, index) {
							return changeDateFormat(value)
						}
					}, {
						field: 'sort_no',
						title: '排序号',
						align: 'center',
					}, {
						field: 'cz',
						title: '操作',
						width: '200px',
						align: 'center',
						formatter: function(value, row, index) {
							return '<button data-toggle="modal" data-target="#myModal2" onclick="findByBagId(' + row.project_id + ')" class="btn btn-warning">修改<span class="glyphicon glyphicon-pencil" aria-hidden="true"></span></button>' + '&nbsp&nbsp' + '<button onclick="del(' + row.project_id + ')" class="btn btn-danger">删除<span class="glyphicon glyphicon-remove" aria-hidden="true"></span></button>' + '<button data-toggle="modal" data-target="#myModal3" onclick="findByBagId2(' + row.project_id + ')" class="btn btn-info"><span class="glyphicon glyphicon-search" aria-hidden="true"></span>&nbsp;查看详情</button>'
						}

					}]

				});

			};

			//得到查询的参数

			oTableInit.queryParams = function(params) {

				var temp = { //这里的键的名字和控制器的变量名必须一直，这边改动，控制器也需要改成一样的

					//偏移量
					offset: params.offset,

					//每页多少条数据
					pageSize: params.limit,

					project_id: $("#project_id").val(),

					project_name: $("#project_name").val(),

					type_id: $("#type_id").val(),

					status: $("#status").val()
				};
				return temp;
			};
			return oTableInit;
		};

		//转换日期格式(时间戳转换为datetime格式)
		function changeDateFormat(cellval) {
			var dateVal = cellval + "";
			if(cellval != null) {
				var date = new Date(parseInt(dateVal.replace("/Date(", "").replace(")/", ""), 10));
				var month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
				var currentDate = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();

				var hours = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
				var minutes = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
				var seconds = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();

				return date.getFullYear() + "-" + month + "-" + currentDate + " " + hours + ":" + minutes + ":" + seconds;
			}
		}
		
		
		//删除
		function del(project_id) {
			$.ajax({
				type: "post",
				url: "/bnp/deleteId/" + project_id,
				success: function(data) {
					$("#table").bootstrapTable('refresh');
				}
			});
		}

		//添加
		$("#addbtn").click(function() {
			var sHTML = $('.summernote').summernote('code');
			$('#content').val(sHTML);
			$("#fm").submit() //提交
			$("#myModal").modal("hide")
			$("#table").bootstrapTable('refresh');
		})

		//分类下拉框
		$.ajax({
			type: "get",
			url: "/bnt/type",
			success: function(data) {
				var items = data.rows;
				console.log('=======' + items);
				for(i = 0; i < items.length; i++) {
					$("#type_id").append("<option value='" + items[i].type_id + "'>" + items[i].type_name + "</option>");
					$("#type_id1").append("<option value='" + items[i].type_id + "'>" + items[i].type_name + "</option>");
					$("#type_id2").append("<option value='" + items[i].type_id + "'>" + items[i].type_name + "</option>");
				}
			}
		})

		//查询
		$('#btns').click(function() {
			$('#table').bootstrapTable('refresh');
		})

		//根据ID查询
		function findByBagId(project_id) {
			$.ajax({
				type: "post",
				url: "/bnp/findByProjectId/" + project_id,
				success: function(data) {
					$("#project_id1").val(project_id);
					$("#project_name1").val(data.rows.project_name);
					$("#type_id2").val(data.rows.type_id);
					$("#server_time1").val(data.rows.server_time);
					$("#rmb_price1").val(data.rows.rmb_price);
					$("#beauty_price1").val(data.rows.beauty_price);
					$("#manual_price1").val(data.rows.manual_price);
					$("#active_price1").val(data.rows.active_price);
					$("#status1").val(data.rows.status);
					$("#sort_no1").val(data.rows.sort_no);
					$("#use_device1").val(data.rows.use_device);
					$("#cover_photo3").attr("src",data.rows.cover_photo)
					$("#cover_big_photo3").attr("src",data.rows.cover_big_photo)
					$('#content_editer1').summernote('code',data.rows.content);
				}
			});
		}
		
		//查看详情
			function findByBagId2(project_id) {
			$.ajax({
				type: "post",
				url: "/bnp/findByProjectXQ/" + project_id,
				success: function(data) {
						$("#project_id2").html(data.rows.project_id)
						$("#project_name2").html(data.rows.project_name)
						$("#type_id3").html(data.rows.bisNurseType.type_name)	
						$("#server_time2").html(data.rows.server_time)
						$("#rmb_price2").html(data.rows.rmb_price)
						$("#beauty_price2").html(data.rows.beauty_price)
						$("#manual_price2").html(data.rows.manual_price)
						$("#active_price2").html(data.rows.active_price)
						$("#status2").html(data.rows.status)
						if(data.rows.status==1){
							$("#status2").html("在售");
						}else if(data.rows.status==2){
							$("#status2").html("下架");
						}
						$("#sort_no2").html(data.rows.sort_no)
						$("#use_device2").html(data.rows.use_device)
						$("#create_time2").html(changeDateFormat(data.rows.create_time))
						$("#modify_time2").html(changeDateFormat(data.rows.modify_time))
						$("#cover_photo2").attr("src",data.rows.cover_photo)
						$("#cover_big_photo2").attr("src",data.rows.cover_big_photo)
						$('#content_editer2').summernote('code',data.rows.content);
				}
			});
		}

		//修改
		$("#updatebtn").click(function() {
					var sHTML = $('#content_editer1').summernote('code');
					$('#content1').val(sHTML);
					$("#fm2").submit() //提交
					$("#myModal2").modal("hide")
					$("#table").bootstrapTable('refresh');
		})
		
		
		//关闭后清空信息
		function restClose(){
			document.getElementById("fm").reset();
		}
		
		//富文本编辑器方法
			$(function() {
				$('.summernote').summernote({
					height: 300,
					tabsize: 2,
					lang: 'zh-CN',
					focus: true,
					callbacks: {
						// 重写图片上传
						onImageUpload: function(files, editor, $editable) {
							sendFile(this, files[0], editor, $editable);
						}
					}
				});
				//提交按钮点击事件
				/*$("#sub").click(function() {
					var sHTML = $('.summernote').summernote('code');
					console.log("添加内容：" + sHTML);
					$('#content').val(sHTML);
					myform.submit(); //提交
				});*/
			});
			
			//富文本编辑器方法
			$(function() {
				$('.summernote').summernote({
					height: 300,
					tabsize: 2,
					lang: 'zh-CN',
					focus: true,
					callbacks: {
						// 重写图片上传
						onImageUpload: function(files, editor, $editable) {
							sendFile(this, files[0], editor, $editable);
						}
					}
				});
				//提交按钮点击事件
//				$("#sub2").click(function() {
//					var sHTML = $('#content_editer1').summernote('code');
//					console.log("修改内容：" + sHTML);
//					$('#content1').val(sHTML);
//					myformS.submit(reset); //提交
//				});
			});




			//图片上传
			function sendFile(val, file, editor, $editable) {
				var filename = false;
				try {
					filename = file['name'];
				} catch(e) {
					filename = false;
				}
				if(!filename) {
					$(".note-alarm").remove();
				}

				//以上防止在图片在编辑器内拖拽引发第二次上传导致的提示错误
				data = new FormData();
				data.append("file", file);
				data.append("key", filename); //唯一性参数
				$.ajax({
					data: data,
					type: "post",
					url: "/bnp/fileUpload",
					cache: false,
					contentType: false,
					processData: false,
					success: function(url) {
						if(url == '200') {
							alert("上传失败！");
							return;
						} else {
							alert("上传成功！");
						}
						var path = url.path;
						
						console.log("返回路径：" + path);
						console.log("val=" + val);
						$(val).summernote('insertImage', path);
						//editor.insertImage($editable, url);
						//setTimeout(function(){$(".note-alarm").remove();},3000);
					},
					error: function() {
						alert("上传失败喽！");
						return;
						//setTimeout(function(){$(".note-alarm").remove();},3000);
					}
				});
			}
	</script>

</html>